import { request} from '@/utils/request.util';
import type {Root,DeptListRoot} from '@/types/root'
import type { Response, Res } from '@/types/common';

export interface NoticeTableRoot {
     code: string;
     msg: string;
     timestamp: number;
     data: NoticeTableRootData;
     ok: boolean;
};

export interface NoticeTableRootData {
     totalCount: number;
     list: Array<NoticeTableRootDataList>;
};

export interface NoticeTableRootDataList {
     noticeId: number;
     noticeName: string;
     noticeContent: string;
     noticeTime: Date;
     isRead: string;
};


//查询消息未读数
export const getUnreadNum = () => request.get<Response<DeptListRoot>>("/clinic/notice/getUnreadNum", {});


// 查看消息列表
export const getNoticeList =  (body:{
  pageNo:number,
  pageSize:number,
}) => request.get<{
     code: string;
     msg: string;
     timestamp: number;
     data: any;
     ok: boolean;
}> ("/clinic/notice/getNoticeList", {
  params: body
});  


//标记已读
export const markRead = (body: {
  ids: any[]
}) => request.post<Response<Res>>("/clinic/notice/markRead",body);


//标记删除
export const markDelete = (body: {
  ids: any[]
}) => request.post<Response<Res>>("/clinic/notice/markDelete",body);


//全部已读
export const markAllRead = () => request.post<Response<Res>>("/clinic/notice/markAllRead",{});
